package com.func.domain.award.model.aggregate;

import com.func.domain.award.model.entity.UserAwardRecordEntity;
import com.func.domain.award.model.entity.UserCreditAwardEntity;
import com.func.domain.award.model.valobj.AwardStateVO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * <p>
 * GiveOutPrizesAggregate
 * </p>
 *
 * @author Simon
 * @version 2025.03.20.1.0.0
 * @description 发放奖品聚合对象
 * @since 2025-03-20
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class GiveOutPrizesAggregate {
    // 用户ID
    private String userId;
    // 用户中奖记录
    private UserAwardRecordEntity userAwardRecordEntity;
    // 用户积分奖品
    private UserCreditAwardEntity userCreditAwardEntity;

    public static UserAwardRecordEntity buiDistributeUserAwardRecordEntity(String userId, String orderId, Integer awardId, AwardStateVO awardState) {
        UserAwardRecordEntity userAwardRecord = new UserAwardRecordEntity();
        userAwardRecord.setUserId(userId);
        userAwardRecord.setAwardId(awardId);
        userAwardRecord.setOrderId(orderId);
        userAwardRecord.setAwardState(awardState);
        return userAwardRecord;
    }

    public static UserCreditAwardEntity buildUserCreditAwardEntity(String userId, BigDecimal creditAmount) {
        UserCreditAwardEntity userCreditAwardEntity = new UserCreditAwardEntity();
        userCreditAwardEntity.setCreditAmount(creditAmount);
        userCreditAwardEntity.setUserId(userId);
        return userCreditAwardEntity;
    }
}
